package ThreadDemo;

public class SecondThread implements Runnable {
    private int i = 0;
    public void run() {
        for ( ; i < 1000; i++) {
            System.out.println(Thread.currentThread().getName() + " " + i);
        }

    }

    public static void main(String[] args) {
        //创建Runnable实现类的实例
        SecondThread secondThread = new SecondThread();
        //作为Thread的target创建真正的线程对象
        Thread thread = new Thread(secondThread);
        for (int j = 0; j < 100; j++) {
            System.out.println(Thread.currentThread().getName() + " " + j);
            if (j == 0) {
                thread.start();
            }
        }
    }
}
